unit uPSI_GLUtils;
{
This file has been generated by UnitParser v0.7, written by M. Knight
and updated by NP. v/d Spek and George Birbilis. 
Source Code from Carlo Kok has been used to implement various sections of
UnitParser. Components of ROPS are used in the construction of UnitParser,
code implementing the class wrapper is taken from Carlo Kok's conv utility

}
interface
 
uses
   SysUtils
  ,Classes
  ,uPSComponent
  ,uPSRuntime
  ,uPSCompiler
  ;
 
type 
(*----------------------------------------------------------------------------*)
  TPSImport_GLUtils = class(TPSPlugin)
  protected
    procedure CompileImport1(CompExec: TPSScript); override;
    procedure ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter); override;
  end;
 

{ compile-time registration functions }
procedure SIRegister_GLUtils(CL: TPSPascalCompiler);

{ run-time registration functions }
procedure RIRegister_GLUtils_Routines(S: TPSExec);
procedure RIRegister_GLUtils(CL: TPSRuntimeClassImporter);

procedure Register;

implementation


uses
   Graphics
  ,Controls
  ,GLVectorGeometry
  ,GLCrossPlatform
  ,GLUtils
  ;
 
 
procedure Register;
begin
  RegisterComponents('Pascal Script', [TPSImport_GLUtils]);
end;

(* === compile-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure SIRegister_GLUtils(CL: TPSPascalCompiler);
begin
  CL.AddClassN(CL.FindClass('TOBJECT'),'EGLUtilsException');
//  CL.AddTypeS('PSqrt255Array', '^TSqrt255Array // will not work');
// CL.AddDelphiFunction('Procedure WordToIntegerArray( Source : PWordArray; Dest : PIntegerArray; Count : Cardinal)');
 CL.AddDelphiFunction('Function RoundUpToPowerOf2( value : Integer) : Integer');
 CL.AddDelphiFunction('Function RoundDownToPowerOf2( value : Integer) : Integer');
 CL.AddDelphiFunction('Function IsPowerOf2( value : Integer) : Boolean');
 CL.AddDelphiFunction('Function ReadCRLFString( aStream : TStream) : AnsiString');
 CL.AddDelphiFunction('Procedure WriteCRLFString( aStream : TStream; const aString : AnsiString)');
 CL.AddDelphiFunction('Function TryStrToFloat( const strValue : String; var val : Extended) : Boolean');
 CL.AddDelphiFunction('Function StrToFloatDef( const strValue : String; defValue : Extended) : Extended');
 CL.AddDelphiFunction('Function StringToColorAdvancedSafe( const Str : string; const Default : TColor) : TColor');
 CL.AddDelphiFunction('Function TryStringToColorAdvanced( const Str : string; var OutColor : TColor) : Boolean');
 CL.AddDelphiFunction('Function StringToColorAdvanced( const Str : string) : TColor');
 CL.AddDelphiFunction('Function ParseInteger( var p : PChar) : Integer');
 CL.AddDelphiFunction('Function ParseFloat( var p : PChar) : Extended');
 CL.AddDelphiFunction('Procedure SaveAnsiStringToFile( const fileName : String; const data : AnsiString)');
 CL.AddDelphiFunction('Function LoadAnsiStringFromFile( const fileName : String) : AnsiString');
 CL.AddDelphiFunction('Procedure SaveComponentToFile( const Component : TComponent; const FileName : string; const AsText : Boolean)');
 CL.AddDelphiFunction('Procedure LoadComponentFromFile( const Component : TComponent; const FileName : string; const AsText : Boolean)');
 CL.AddDelphiFunction('Function SizeOfFile( const fileName : String) : Int64');
// CL.AddDelphiFunction('Function GetSqrt255Array : PSqrt255Array');
 CL.AddDelphiFunction('Procedure InformationDlg( const msg : String)');
 CL.AddDelphiFunction('Function QuestionDlg( const msg : String) : Boolean');
 CL.AddDelphiFunction('Function InputDlg( const aCaption, aPrompt, aDefault : String) : String');
 CL.AddDelphiFunction('Function SavePictureDialog( var aFileName : String; const aTitle : String) : Boolean');
 CL.AddDelphiFunction('Function OpenPictureDialog( var aFileName : String; const aTitle : String) : Boolean');
end;

(* === run-time registration functions === *)
(*----------------------------------------------------------------------------*)
procedure RIRegister_GLUtils_Routines(S: TPSExec);
begin
// S.RegisterDelphiFunction(@WordToIntegerArray, 'WordToIntegerArray', cdRegister);
 S.RegisterDelphiFunction(@RoundUpToPowerOf2, 'RoundUpToPowerOf2', cdRegister);
 S.RegisterDelphiFunction(@RoundDownToPowerOf2, 'RoundDownToPowerOf2', cdRegister);
 S.RegisterDelphiFunction(@IsPowerOf2, 'IsPowerOf2', cdRegister);
 S.RegisterDelphiFunction(@ReadCRLFString, 'ReadCRLFString', cdRegister);
 S.RegisterDelphiFunction(@WriteCRLFString, 'WriteCRLFString', cdRegister);
 S.RegisterDelphiFunction(@TryStrToFloat, 'TryStrToFloat', cdRegister);
 S.RegisterDelphiFunction(@StrToFloatDef, 'StrToFloatDef', cdRegister);
 S.RegisterDelphiFunction(@StringToColorAdvancedSafe, 'StringToColorAdvancedSafe', cdRegister);
 S.RegisterDelphiFunction(@TryStringToColorAdvanced, 'TryStringToColorAdvanced', cdRegister);
 S.RegisterDelphiFunction(@StringToColorAdvanced, 'StringToColorAdvanced', cdRegister);
 S.RegisterDelphiFunction(@ParseInteger, 'ParseInteger', cdRegister);
 S.RegisterDelphiFunction(@ParseFloat, 'ParseFloat', cdRegister);
 S.RegisterDelphiFunction(@SaveAnsiStringToFile, 'SaveAnsiStringToFile', cdRegister);
 S.RegisterDelphiFunction(@LoadAnsiStringFromFile, 'LoadAnsiStringFromFile', cdRegister);
 S.RegisterDelphiFunction(@SaveComponentToFile, 'SaveComponentToFile', cdRegister);
 S.RegisterDelphiFunction(@LoadComponentFromFile, 'LoadComponentFromFile', cdRegister);
 S.RegisterDelphiFunction(@SizeOfFile, 'SizeOfFile', cdRegister);
// S.RegisterDelphiFunction(@GetSqrt255Array, 'GetSqrt255Array', cdRegister);
 S.RegisterDelphiFunction(@InformationDlg, 'InformationDlg', cdRegister);
 S.RegisterDelphiFunction(@QuestionDlg, 'QuestionDlg', cdRegister);
 S.RegisterDelphiFunction(@InputDlg, 'InputDlg', cdRegister);
 S.RegisterDelphiFunction(@SavePictureDialog, 'SavePictureDialog', cdRegister);
 S.RegisterDelphiFunction(@OpenPictureDialog, 'OpenPictureDialog', cdRegister);
end;

(*----------------------------------------------------------------------------*)
procedure RIRegister_GLUtils(CL: TPSRuntimeClassImporter);
begin
  with CL.Add(EGLUtilsException) do
end;

 
 
{ TPSImport_GLUtils }
(*----------------------------------------------------------------------------*)
procedure TPSImport_GLUtils.CompileImport1(CompExec: TPSScript);
begin
  SIRegister_GLUtils(CompExec.Comp);
end;
(*----------------------------------------------------------------------------*)
procedure TPSImport_GLUtils.ExecImport1(CompExec: TPSScript; const ri: TPSRuntimeClassImporter);
begin
  RIRegister_GLUtils(ri);
  RIRegister_GLUtils_Routines(CompExec.Exec); // comment it if no routines
end;
(*----------------------------------------------------------------------------*)
 
 
end.
